Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken validation CI step #52

Merged
merged 2 commits into from
Feb 8, 2024
Merged

Fix broken validation CI step #52

merged 2 commits into from
Feb 8, 2024

Conversation

mschwager
Copy link
Member

The validate CI step is broken because it thinks our GHA YAML files are Semgrep rules: https://github.com/trailofbits/semgrep-rules/actions/runs/7656054543/job/21278776025?pr=49. This PR changes validation to only validate top-level, non-hidden directories.

Copy link
Collaborator

@GrosQuildu GrosQuildu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Wondering why the --exclude flag does not work here.

@mschwager
Copy link
Member Author

LGTM. Wondering why the --exclude flag does not work here.

Good question, I originally thought that would work too. The problem is that --exclude is for target files (e.g. Python code), not Semgrep rule files. The --validate flag is a weird one because it does not operate on any target files. This is why we have to specify multiple --config flags in this hacky way.

Another thought might be: can we use --exclude-rule? But the problem here is that the YAML files being considered as rules (the GitHub Action files) are not valid rules, so Semgrep errors out before --exclude-rule could do its thing.

Another option here would be removing the --validate step. IIRC calling --test performs all the same actions as --validate, except calling p/semgrep-rule-lints on the rules. And we do that manually later in the CI job anyway.

@GrosQuildu
Copy link
Collaborator

Validate does runs a combination of Semgrep rules and OCaml checks. You say that test runs OCaml checks (whatever these are)?
Anyway I would rather keep validate as separate step - it could be confusing if we error/warn in test about technical bug in a rule rather than expected semantic bug.

Let's merge imho.

@mschwager mschwager merged commit 81f98c4 into main Feb 8, 2024
3 checks passed
@mschwager mschwager deleted the mschwager-fix-validation branch February 8, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants